<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ include file="/includes/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>选修课程</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/common.css" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript" src="<%=request.getContextPath()%>/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">

	 var type = '${type}';
		if(type=='add'){
			alert("操作成功！");
		}
  function loadDepartment(){
		var action = "loadDepartmentJson.action";
		$.getJSON(action,function(data){
			var json = eval(data);
			$.each(json,function(i,n){
				
					$("#departmentId").append('<option value='+json[i].id+'>'+json[i].name+'</option>');
				
			})
		})
		
		 loadCourse();
	}
	function loadCourse(){
		var action = "loadCourseJson.action";
		$.getJSON(action,function(data){
			var json = eval(data);
			$.each(json,function(i,n){
				    
					$("#course").append('<input type="checkbox" name="coursearray" value='+json[i].id+'>'+json[i].name);
				
			})
		})
		
		
	}
	function selClass(){
		
		var id = $("#departmentId").val();			
		var action = "listClazzJson.action?department.id="+id;
		$.getJSON(action,function(data){
			var json = eval(data);
			$("#clazz").text("");
			$.each(json,function(i,n){
					$("#clazz").append('<input type="checkbox" name="clazzarray" value='+json[i].id+'>'+json[i].name);
			});
		})
	}
	
</script>
</head>
	<body onload="loadDepartment();">
		<div id="man_zone">
		<form action="saveScore.action" method="post" id="form1" >
		<input type="hidden"  name="student.id" value="${student.id}"/>
		<input type="hidden"  name="student.version" value="${student.version}"/>
		 <table class="table_style" border="0" align="center"  cellpadding="3" cellspacing="1" width="800px">
		   	<tr>
		   		<td class="left_title_1">专业:</td>
		   		<td>
		   		<select id="departmentId"  onchange="selClass();">
					<option>---请选择专业---</option>
				</select>
				   <s:if test="hasFieldErrors() && fieldErrors.get('clazzarray') != null">
					 <s:fielderror><s:param>clazzarray</s:param></s:fielderror>
				    </s:if>
				</td>
		   		<td id="clazz">&nbsp;</td>
		   		
		   	</tr>
		   	<tr>
		   		
		   		<td class="left_title_1">选择课程(必选):</td>
		   		<td id="course">
		   		  <s:if test="hasFieldErrors() && fieldErrors.get('coursearray') != null">
					 <s:fielderror><s:param>coursearray</s:param></s:fielderror>
				  </s:if>
		   		</td>	
		   		<td >&nbsp;</td>
		        
           </tr>
		 </table>
		  <table class="table_style" border="0" align="center"  cellpadding="3" cellspacing="0">
       		<tr>
         <td>
          <input type="submit" value="提交" />
          <span class="sub_sp">&nbsp;</span>
          <s:reset value="重置"/>  
         </td>
       </tr>
	</table>
		</form>
		</div>
	</body>
</html>